package study.optional.最常见的应用场景;

import study.optional.公共类.User;

import java.util.Optional;

/**
 * @Author 刘伟涛
 * @Date 2023/6/30 16:41
 **/
public class Demo02 {
    public static void main(String[] args) {
        Integer a = null;
        Integer b = 4;
        a = Optional.ofNullable(a).orElse(a = 3);
        System.out.println(a);

        Object integer = Optional.ofNullable(b).orElseGet(() -> 1);
        System.out.println(integer);
    }
}
